package com.foreknow.demo14;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

public class Test {
    public static void main(String[] args) {
        DBUtil dbUtil = new DBUtil();
        try {
            //1.连接数据库
            Connection conn = dbUtil.Connect();
            //2.调用查询的方法
            ResultSet rs = dbUtil.Select("select * from guestbook where id=?","1");
            while (rs.next()){
                System.out.println(rs.getInt("id")+"  "+rs.getString("name"));
            }
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
